import request from "@/utils/request";
const api_name = "/course";
// export default {
//     getList(page, limit, searchObj) {
//         return request({
//             url: `${api_name}/list/${page}/${limit}`,
//             method: "post",
//             data: searchObj
//         });
//     }
// };

export default {
    // 获取讲师列表数据
    getList(page, limit, searchObj) {
        return request({
            url: `http://39.98.120.230:8080/api/course/list/${page}/${limit}`,
            method: "post",
            data: searchObj
        });
    },
    //删除
    deleteCourseById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: "delete"
        });
    },
    //添加课程基本信息
    addCourse(course) {
        return request({
            url: "http://39.98.120.230:8080/api/course/",
            method: "post",
            data: course
        });
    },
    //根据id获取课程基本信息
    getCourseInfoById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: "get"
        });
    },
    //更新课程基本信息
    updateCourse(course) {
        return request({
            url: `http://39.98.120.230:8080/api/course/${course.id}`,
            method: "put",
            data: course
        });
    },
    //根据id最终发布课程信息
    getPublishInfoById(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/publishinfo/${id}`,
            method: "get"
        });
    },

    //发布课程
    publishCourse(id) {
        return request({
            url: `http://39.98.120.230:8080/api/course/publish/${id}`,
            method: "put"
        });
    }
};